﻿<Window x:Class="WP2BE.MainWindow"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" 
        xmlns:ViewModel="clr-namespace:WP2BE.ViewModel"
        Title="MainWindow" Width="640" Height="580" Background="#FF4F5E7A" Closing="Window_Closing">

    <Window.DataContext>
        <ViewModel:PostOptionViewModel />
    </Window.DataContext>

    <Window.Resources>
        <Style TargetType="{x:Type Label}">
            <Setter Property="HorizontalAlignment" Value="Left" />
            <Setter Property="VerticalAlignment" Value="Center" />
            <Setter Property="Foreground" Value="White" />
        </Style>
        <Style TargetType="{x:Type TextBox}">
            <Setter Property="Margin" Value="10, 5, 0, 5" />
            <Setter Property="Background" Value="#FFC7C7C7" />
            <Setter Property="VerticalAlignment" Value="Center" />
            <Setter Property="HorizontalAlignment" Value="Stretch" />
        </Style>
        <Style TargetType="{x:Type Button}" BasedOn="{StaticResource FlatButton}" >
            <Setter Property="Margin" Value="10, 0, 10,0" />
            <Setter Property="HorizontalAlignment" Value="Center" />
            <Setter Property="VerticalAlignment" Value="Center" />
        </Style>

    </Window.Resources>

 <Grid x:Name="LayoutRoot">
        <Grid.RowDefinitions>
            <RowDefinition Height="Auto" />
            <RowDefinition Height="Auto" />
            <RowDefinition Height="Auto" />
            <RowDefinition Height="Auto" />
            <RowDefinition Height="Auto" />
            <RowDefinition Height="Auto" />
            <RowDefinition Height="Auto" />
            <RowDefinition Height="*" />
            <RowDefinition Height="Auto" />
            <RowDefinition Height="Auto" />
            <RowDefinition Height="Auto" />
        </Grid.RowDefinitions>
        <Grid.ColumnDefinitions>
            <ColumnDefinition Width="Auto" />
            <ColumnDefinition />
            <ColumnDefinition Width="Auto" />
        </Grid.ColumnDefinitions>
        <Label Grid.Row="0" Grid.Column="0">WordPress File:</Label>
        <TextBox Grid.Row="0" Grid.Column="1" Margin="10, 10, 0, 5" Text="{Binding WpFileName}" />
        <Button Grid.Row="0" Grid.Column="3" Command="{Binding OpenWpFile}">Open</Button>
        <Label Grid.Row="1" Grid.Column="0">Post Folder:</Label>
        <TextBox Grid.Row="1" Grid.Column="1" Text="{Binding PostFolder}" />
        <Button Grid.Row="1" Grid.Column="3" Command="{Binding OpenPostFolder}" >Open</Button>
        <Label Grid.Row="2" Grid.Column="0" >Local Image Folder:</Label>
        <TextBox Grid.Row="2" Grid.Column="1" Text="{Binding LocalImageFolder}" />
        <Button Grid.Row="2" Grid.Column="3" HorizontalAlignment="Center" Command="{Binding OpenImageFolder}">Open</Button>
        <Label Grid.Row="3" Grid.Column="0">Blog URL:</Label>
        <TextBox Grid.Row="3" Grid.Column="1" Text="{Binding BlogUrl}" />
        <Label Grid.Row="4" Grid.Column="0">Relative Image Folder:</Label>
        <TextBox Grid.Row="4" Grid.Column="1" Text="{Binding RelImageFolder}" />
        <Label Grid.Row="5" Grid.Column="0">Author</Label>
        <TextBox Grid.Row="5" Grid.Column="1" Text="{Binding AuthorName}" />
        <StackPanel Grid.Row="6" Grid.ColumnSpan="2" Margin="5, 10, 0, 10">
            <CheckBox Content="Include Draft" IsChecked="{Binding IncludeDraft, Mode=TwoWay}" HorizontalAlignment="Left" Margin="0, 0, 0, 5" />
            <CheckBox Content="Download Images" IsChecked="{Binding DownloadImages, Mode=TwoWay}" HorizontalAlignment="Left" Margin="0, 0, 0, 5" />
            <CheckBox Content="Add Image Drop Shadow" IsChecked="{Binding AddImgDropShadow, Mode=TwoWay}" HorizontalAlignment="Left" />
        </StackPanel>
        <ListView Grid.Row="7" Grid.ColumnSpan="3" ItemsSource="{Binding ProcessingLogs}" Margin="5, 0, 5, 10" >
            <ListView.ItemTemplate>
                <DataTemplate>
                <StackPanel Orientation="Horizontal">
                        <Image Width="20" Height="20" Source="{Binding Image}" />
                        <Label Foreground="Black" Content="{Binding Txt}" />
                </StackPanel>
                </DataTemplate>
            </ListView.ItemTemplate>
        </ListView>
        <Label Grid.Row="8" Grid.ColumnSpan="3" Content="{Binding DownloadingImageText}" />
        <ProgressBar Grid.Row="9" Value="{Binding Path=ProgressBarValue}" Minimum="{Binding Min}" Maximum="{Binding Max}" Grid.ColumnSpan="3" Height="20" Margin="5, 10, 5, 10" Name="progressBar2" />
        <Button Grid.Row="10" Grid.Column="0" Command="{Binding CancelDownload}" Grid.ColumnSpan="2" Margin="5, 0, 0, 5" HorizontalAlignment="Left">Cancel</Button>
<!--        <Button Grid.Row="9" Grid.Column="0" Command="{Binding Close}" CommandParameter="{Binding RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type Window}}}" Grid.ColumnSpan="2" Margin="5, 0, 0, 5" HorizontalAlignment="Left">Cancel</Button>-->
        <Button Grid.Row="10" Grid.Column="2" Command="{Binding Save}" Margin="0, 0, 0, 5">Save</Button>

    </Grid>
</Window>